﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using Kunlun.Models;

namespace Kunlun.BusinessLogic
{
    public class KunlunConsumer
    {
        public static KunLunEntities entities = new KunLunEntities();


        /// <summary>
        /// 获取指定ID的客户实体
        /// </summary>
        /// <param name="ConsumerID">客户ID</param>
        /// <returns>返回实体或者NULL</returns>
        public static Consumer GetConsumerModel(int ConsumerID)
        {
            using (entities)
            {
                var model = entities.Consumers.FirstOrDefault(m => m.ID == ConsumerID);

                return model;
            }
        }

        public static Consumer ValidateConsumer(string userName, string password)
        {
            var model = entities.Consumers.FirstOrDefault(m => m.UserName == userName && m.Password == password);

            return model;
        }

    }
}
